#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cassert>

using namespace std;

//namespace Amount {
//    int move(int n)
//    {
//        if (n == 1)
//        {
//            return 1;
//        }
//        else
//        {
//            return 2 * (move(n - 1) + 2);
//        }
//    }
//};
//
//int main()
//{
//    int n = 0;
//    cin >> n;
//    cout << Amount::move(n);
//    return 0;
//};


class Data
{
public:
    int GetMonthDay(const int& year, const int& month)
    {
        assert(month > 0 && month < 13);
        int arr_day[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
        if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0))
        {
            return 29;
        }
        else
        {
            return arr_day[month];
        }
    }
    Data(int year = 1, int month = 1, int day = 1)
        :_year(year)
        , _month(month)
        , _day(day)
    {
        if (year < 1900 || year>2200)
            exit(1);
        else if (month < 1 || month>12)
            exit(1);
        else if (day<1 || day>GetMonthDay(year, month))
            exit(1);
        else
            ;
    }

    int GetYearDay()
    {
        int count = 0;
        int i = 1;
        while (i < _month)
        {
            count += GetMonthDay(_year, i);
            ++i;
        }
        return (count + _day);
    }
private:
    int _year;
    int _month;
    int _day;
};

int main() {
    int year = 1, month = 1, day = 1;
    cin >> year >> month >>day;
    Data d(year, month, day);

    cout << d.GetYearDay();

}